package legumes.client.services.callbacks;

import java.util.List;

import legumes.client.services.LegumesServicesHelper;
import legumes.client.services.util.rpc.SequencableRPCCall;
import legumes.shared.domain.LatLng;
import legumes.shared.domain.Store;

public class GetStoreCallback extends SequencableRPCCall<List<Store>> {

	private LatLng northEastBound;
	private LatLng southWestBound;
	private List<Store> storeList;

	public GetStoreCallback(LatLng northEastBound_, LatLng southWestBound_) {
		northEastBound = northEastBound_;
		southWestBound = southWestBound_;
	}

	@Override
	protected void doCall() {
		LegumesServicesHelper.LEGUMES_SERVICES.getStores(northEastBound, southWestBound, this);
	}

	@Override
	public void onSuccess(List<Store> result_) {
		storeList = result_;
		callNext();
	}

	public List<Store> getStores() {
		return storeList;
	}

}